package com.wdh.kjs.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.wdh.kjs.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by chenqinhuang on 2016/4/20.
 */

public class ChooseRepayModeAdapter extends BaseAdapter {
    private List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
    private Context context;
    private HashMap<String, String> maps = new HashMap<String, String>();
    public ChooseRepayModeAdapter(Context context, List<HashMap<String, String>> data) {
        this.data = data;
        this.context = context;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;

        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = View.inflate(context, R.layout.choose_repay_mode, null);
            viewHolder.choose_repay_mode = (TextView) convertView.findViewById(R.id.choose_repay_mode);
            viewHolder.choose_repay_mode_LinearLayout = (LinearLayout) convertView.findViewById(R.id.choose_repay_mode_LinearLayout);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        maps = data.get(position);
        if (maps != null) {
            viewHolder.choose_repay_mode.setText(maps.get("choose_repay_mode"));
        }
        return convertView;
    }

    class ViewHolder {
        TextView choose_repay_mode;
        LinearLayout choose_repay_mode_LinearLayout;
    }

}